$(function(){
    $("#saveBtn").on('click',function () {
        var userName = $("#userName").val();
        var password = $("#password").val();
        if(userName.trim()==""){
            $("#tip").html("请输入用户名密码");
        }
        $.ajax({
            url: "/user/api/checkLogin?userName="+userName+"&password="+password,
            type: "POST",
            cache: false,
            async: false,//同步请求
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            success: function (data) {
                if(data.code=="200"){
                    window.location.href="/main";
                }else {
                    $("#tip").html(data.message);
                }
            }
        });
    });

    $(".loginInfo").on("focus",function () {
        $("#tip").html("");
    });
});